package com.bs.mapper;

import com.bs.bean.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Mapper
@Repository
public interface CommentMapper {

    //添加一个评论
    int saveComment(Comment comment);

    ArrayList<Comment> getAllCommentByName(String nickname);

    Boolean deleteCommentById(Integer id);

    List<Comment> getAllComment();

    List<Comment> getCommentByName(String nickname);

    void updateStateByComment(Comment comment);

    Comment getCommentById(Integer id);

    //查询父级评论
    List<Comment> findByParentIdNull(@Param("ParentId") Long ParentId, @Param("videoId") Integer videoId);

    //查询一级回复
    List<Comment> findByParentIdNotNull(@Param("id") Long id);

    //查询二级以及所有子集回复
    List<Comment> findByReplayId(@Param("childId") Long childId);

}